package com.demos.springcloud.consumer02_feign.controller;

import com.demos.springcloud.consumer02_feign.service.Provider1ServiceInterface;
import com.demos.springcloud.consumer02_feign.service.Provider2ServiceInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("feign")
public class controller {
    @Autowired
    private Provider1ServiceInterface provider1ServiceInterface;

    @Autowired
    private Provider2ServiceInterface provider2ServiceInterface;

    @GetMapping("get/{id}")
    public Map<String, Object> doGet(@PathVariable String id){
        return provider2ServiceInterface.service1(id);
    }

    @GetMapping("post/{id}")
    public Map<String, Object> doPost(@PathVariable String id){
        return provider1ServiceInterface.service1(id);
    }
}
